package com.shg.service.impl.bbs;


import java.util.LinkedHashMap;

import org.springframework.stereotype.Service;

import com.shg.bean.QueryResult;
import com.shg.bean.bbs.Forum;
import com.shg.service.bbs.ForumService;
import com.shg.service.impl.BasiceDaoImpl;

@Service
public class ForumServiceBean extends BasiceDaoImpl<Forum> implements ForumService {

	/**
	 * 分页查询
	 * 根据书籍的ID来查询当前这本书籍的论坛
	 */
	public QueryResult<Forum>  getDiscuss(int firstResult,int maxResult,String bookId,Integer state){
		String whereSQL= " book_id=? and state=?";
		Object [] parameters=new Object[]{bookId,state};
		LinkedHashMap<String, String> orderBy = new LinkedHashMap<String, String>();
		orderBy.put("times", "desc");
		QueryResult<Forum> queryResult = getPagination(Forum.class, firstResult, maxResult, whereSQL, parameters,orderBy);
		return queryResult;
	}

}
